# 写入 对象、列表、字典、元组

cate = ['fried rice with egg','soy sauce fried rice','Fried rice with sausage']


# f = open('../file/testword.txt','w')
# f.write(cate)
# TypeError: write() argument must be str, not list


# 序列化 -1
# f = open('../file/xlh1.txt','w')
# import json
# json_string = json.dumps(group)
# print(type(json_string))
#
# f.write(json_string)

# 序列化 -2
# f = open('../file/xlh2.txt','w')
# import json
# json.dump(cate,f)


# f.close()

# 反序列化 -1
# f = open('../file/xlh2.txt','r')
# result = f.read()
# print(result)
# print(type(result))
#
# import json
# pyObject = json.loads(result)
# print(pyObject)
# print(type(pyObject))

# f.close()


# 反序列化 -2
# f = open('../file/xlh2.txt','r')
#
# import json
# pyObject = json.load(f)
# print(pyObject)
# print(type(pyObject))
#
# f.close()

